<?php
class CateModel extends Model{
	public $table="category";
	public $validate=array(
	array('cname','nonull','分类名称不能为空',2,3),
	array('csort','num:1,65535','分类排序为1到65535的数字',2,3)
	
	);
	public function addData(){
		if(!$this->create())return false;
		return $this->add(); 
		
	}
	public function updateData($id){
		if(!$this->create())return false;
		return $this->where("id='{$id}'")->update();
	}
	public function getSon($data,$id){
		$temp=array();
		foreach ($data as $v) {
			if($v['pid']==$id){
			$temp[]=$v['id'];
		    $temp=array_merge($temp,$this->getSon($data,$v['id']));

			}
		

		}
		return $temp;
	}
	
}
	?>